import { prompt } from "inquirer";

/**
 * @param choices single array or multi array has name and value field
 * @param message message
 */
export async function pickup<T>(
  choices: T[],
  message: string = "Please choose:"
) {
  const { target } = await prompt({
    type: "list",
    name: "target",
    message,
    choices,
  });
  return target;
}

export async function confirm(message: string) {
  const { target } = await prompt({
    type: "confirm",
    name: "target",
    message,
  });
  return target; 
}